/**
 @project DeltaSet JavaScript Test Library
 @version 1.0.0
 @description This is needed by deltaset-faces.
 @author Dimitar Makariev
 */

//////// date picker
// jQuery.datepicker.formatDate('dd/mm/yy', new Date());
//the date formatting is not the same as the one in java...
// yy - is for 4 digit year
// y - is for 2 digit year
// read http://docs.jquery.com/UI/Datepicker/formatDate
// java date format http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html
// jQuery(document).ready(function() {
//jQuery("#datepicker").datepicker();
//     jQuery('.ds-datepicker').each(function(){
//         var dateFormat=jQuery(this).attr('pattern');
//         jQuery(this).datepicker({dateFormat: dateFormat});
//     });
//var obj = document.getElementById('#{cc.clientId}:inputField');
//jQuery(obj).datepicker({dateFormat: 'dd/mm/yy'});
// });
//example           : 2010  10  Jan January 01 01 1 1
//jQuery date format:   yy   y    M      MM mm dd m d
//java date format  : yyyy  yy  MMM    MMMM MM dd M d
//TODO: Implement test for the dates.. probably better in java..
    //read http://docs.jquery.com/UI/Datepicker/formatDate
    // yy - is for 4 digit year
    // y - is for 2 digit year
    //java date format http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html
/**
 * tester
 */
function testConverJavaToJqueryDateFormat() {
    var str='deltaset.datePicker';
    var testArray=[
        {inp:'dd/MM/yyyy',exp:'dd/mm/yy'},
        {inp:'dd/MMM/yyyy',exp:'dd/M/yy'},
        {inp:'dd/MMMM/yyyy',exp:'dd/MM/yy'},
        {inp:'dd/M/yyyy',exp:'dd/m/yy'},
        {inp:'dd/M/yy',exp:'dd/m/y'},
        {inp:'d/M/yy',exp:'d/m/y'},
        {inp:'dd MM yyyy',exp:'dd mm yy'},
        {inp:'dd-MMM-yyyy',exp:'dd-M-yy'},
        {inp:'dd MMMM/yyyy',exp:'dd MM/yy'},
        {inp:'dd,M-yyyy',exp:'dd,m-yy'},
        {inp:'FUN:dd/M-yy',exp:'FUN:dd/m-y'},
        {inp:'d/M/yyKO',exp:'d/m/yKO'}
    ];
    for(t=0;t<testArray.length;t++){
        var fTest=testReplace(testArray[t].inp,testArray[t].exp);
        str+='\n'+fTest+' -> input='+testArray[t].inp+' expected='+testArray[t].exp;
    }
    return str;
}


/**
 * test
 */
function testReplace(inpt,expt) {
//alert('input='+input+'\nexpected='+expected);
    return expt==deltaset._converJavaToJqueryDateFormat(inpt);

}